package com.company;

public class XuanZeSort {
    public static void main(String[] args) {
        int[] number = {13,15,24,99,4,1};
        String end = "\n";
        int index;
        for(int i=1; i<number.length; i++) {
            index = 0;
            for(int j=1; j<number.length-1; j++) {
                if(number[j] > number[index]) {
                    index = j; //查找最大值
                }
            }
            end = number[index] + " " + end; //定位已经排好的数组元素
            int temp = number[number.length-i];
            number[number.length-1]=number[index];
            number[index]=temp;

            for(int j=0;j<number.length-i;j++)
            {
                System.out.print(number[j]+" ");
            }
            System.out.print("】"+end);
        }
    }
}
